package singleton;

//懒汉模式 静态内部类 线程安全
public class StaticInnerSingleton {
    //避免一加载就初始化 , 因为SingletonHolder还未被使用
    private static class  SingletonHolder{
        private static final StaticInnerSingleton singleton = new StaticInnerSingleton();
    }

    private StaticInnerSingleton(){}

    public static final StaticInnerSingleton getInstance(){
        return SingletonHolder.singleton;
    }
}
